Some image capturing apparatuses, such as digital cameras and digital video cameras, are configured to have an autofocusing mechanism for automatically carrying out focus control of a photographing lens and automatically bringing a subject into an in-focus state. The autofocusing mechanism is classified into a distance measurement method and a focus state detection method in terms of the principle of the in-focus method used. In the distance measurement method, the distance to a subject is measured, and the lens position is controlled depending on the measured distance. In the focus state detection method, the focus is detected at an image pickup surface, and the lens position is controlled to an in-focus position. Typical focus state detection methods include a contrast detection method, a phase difference detection method, etc., and the principle of the focus state detection method is disclosed in Japanese Patent Laid-Open No. 4-267211, for example.
Now, the focus state detection method will be described with reference to FIG. 10A through FIG. 12B. For example, in an in-focus state, light ao, bo, and co passing through respective portions of a photographing lens 1 is converged onto an image pickup surface m as shown in FIG. 10A to obtain an in-focus image Z0 on the image pickup surface m as shown in FIG. 10B.
A so-called rear focused state is shown in FIGS. 11A and 11B, in which the focal position is shifted rearward from the in-focus state shown in FIGS. 10A and 10B. Light a1, b1, and c1 passing through respective portions of the photographing lens 1 is converged behind the image pickup surface m as shown in FIG. 11A, thereby respectively resulting in separate images Za1, Zb1, and Zc1 on the image pickup surface m as shown in FIG. 11B.
In addition, a so-called front focused state is shown in FIGS. 12A and 12B. Light a2, b2, and c2 passing through respective portions of the photographing lens 1 is converged in front of the image pickup surface m as shown in FIG. 12A, thereby respectively resulting in separate images Za2, Zb2, and Zc2 on the image pickup surface m as shown in FIG. 128.
As can be seen from FIGS. 11A through 12B, the front focused state and the rear focused state are opposite to each other in the image defocus direction, and the defocus direction and defocus amount are referred to as a so-called defocus amount. Since the relation between the defocus amount and an amount of driving of the focus lens to an in-focus position is determined by the optical system, autofocus control can be carried out by moving the focus lens to the in-focus position.
The processing for calculation of the defocus amount in the phase difference detection method is disclosed in Japanese Patent Laid-Open No. 9-43507 as a known “MIN algorithm”. FIG. 13 illustrates the internal configuration of a typical camera for detecting a correlation of phase differences by the MIN algorithm. Light incident from a lens is reflected downward of the camera by a sub-mirror mounted behind a main mirror mounted and inclined at 45 degrees. Then, the light is separated into two images by a secondary imaging lens to enter AF sensors, not shown. Then, the output data from these two AF sensors is loaded to obtain the correlation between the sensor outputs. Assuming that the respective sensor outputs are designated by a sensor 1 and a sensor 2, the data of the sensor 1 is designated by A[1] to 1[n], and the data of the sensor 2 is designated by B[1] to B[n], the correlation U0 is expressed by the following formula (1) (FIG. 14A).
                              U          ⁢                                          ⁢          0                =                              ∑                          j              =              1                        m                    ⁢                      min            ⁡                          (                                                A                  ⁡                                      [                    j                    ]                                                  ,                                  B                  ⁡                                      [                    j                    ]                                                              )                                                          (        1        )            
(min(a,b) represents a smaller value of a and b)
First, U0 is calculated. Next, as shown in FIG. 14B, the correlation U1 between the data obtained by shifting an A image by just one bit of the AF sensor and the data of a B image is calculated. U1 is expressed by the following formula 2.
                              U          ⁢                                          ⁢          1                =                              ∑                          j              =              1                        m                    ⁢                      min            ⁡                          (                                                A                  ⁡                                      [                                          j                      +                      1                                        ]                                                  ,                                  B                  ⁡                                      [                    j                    ]                                                              )                                                          (        2        )            
(min(a,b) represents a smaller value of a and b)
In this way, correlations obtained by shifting by one bit are calculated one after another. If the two images are coincident with each other, the correlation reaches a maximum (FIG. 14C). Thus, the shift amount and direction are obtained for the maximum value. This value corresponds to the defocus amount.
Meanwhile, Japanese Patent Laid-Open No. 2000-156823 discloses, as a device for implementing the phase difference detection method, an image sensor which has a filter color arrangement as shown in FIG. 15 and two-dimensionally arranged photoelectric conversion cells for converting optical images into electrical signals. As shown in FIG. 15, some of the photoelectric conversion cells are used as first phase sensors S1 and second phase sensors S2 for focus detection in accordance with the phase difference detection method, that is, for purposes other than the forming of image data. According to Japanese Patent Laid-Open No. 2000-156823, the imaging lens for the AF sensor, the secondary imaging lens for providing phase differences, etc., as shown in FIG. 13 are unnecessary, thereby allowing reduction in size of the image capturing apparatus and cost reduction.
Furthermore, Japanese Patent Laid-Open No. 2005-303409 discloses the shapes of focus detection pixels of image sensors. Japanese Patent Laid-Open No. 2005-303409 discloses an arrangement of image sensors as shown in FIG. 16, which includes a basic pixel arrangement referred to as Bayer arrangement of green pixels, red pixels, and blue pixels. The diagonally upper left to lower right pixels of the image sensor serve as pixels for focus detection. The other pixels serve as pixels for generating image data.
FIG. 17 is a diagram illustrating in detail some of the focus detection pixels of the image sensor shown in FIG. 16. This figure illustrates an enlarged view of four pixels composed of two focus detection pixels, one red pixel, and one blue pixel, for explaining the shapes of openings, where the upper left and lower right pixels correspond to the focus detection pixels (green pixels), the upper right pixel corresponds to the red pixel, and the lower left pixel corresponds to the blue pixel. Reference numeral 11 denotes a microlens disposed on top of each opening. Reference numerals 37a and 37b denote center positions of the microlenses 11 in the adjacent focus detection pixels. Reference 36 denotes a line connecting the centers of the microlenses in in-line adjacent focus detection pixels. Reference numerals 38a and 38b each denote openings of the normal blue pixel and red pixel, other than the focus detection pixels. Reference numerals 39a and 39b denote openings of the focus detection pixels, which each have the shape obtained by reducing openings of the normal green pixels with reduction centers 35a and 35b as the centers, where the reduction centers 35a and 35b correspond to points obtained by moving the center positions 37a and 37b of the green pixels along the line 36 in opposite directions to each other, and the openings 39a and 39b of the focus detection have reduced shapes with the reduction centers 35a and 35b as the centers. Therefore, the openings 39a and 39b of the adjacent pixels are offset in different directions. Furthermore, the openings 39a and 39b are symmetrically shaped with respect to lines 46 perpendicular to the line 36.
Furthermore, in Japanese Patent Laid-Open No. 2002-131623, in the case of reading image data in an image sensor which has a plurality of photoelectric conversion units included in one pixel, the charges of the plurality of photoelectric conversion units are added and read out. Then, in the case of carrying out focus detection processing, the charges of the respective photoelectric conversion units are independently read out, and data corresponding to the read charges is used for focus detection processing in a phase difference detection method. In addition, focus detection with a high degree of accuracy is achieved by carrying out processing different from the image correction processing in the adding and reading processing as the image correction processing in the focus detection processing.
However, in Japanese Patent Laid-Open No. 2005-303409, the focus detection pixels of the image sensor are diagonally arranged from the upper left to the lower right of the image sensor, and have shapes and openings reduced more than those of the normal pixels with points offset from the centers of the microlens 11 as the centers. Therefore, the focus detection pixels are different from the normal pixels in aperture, and further different from the normal pixels in the amount of light obtained from the microlenses 11 due to the offset from the centers of the microlenses 11.
Japanese Patent Laid-Open No. 2000-41179 discloses a shading correction method for correcting shading characteristics of decrease in the amount of light input through an optical lens with distance from the optical axis of the lens. A ray of light incident through a photographing lens to an image sensor includes, in addition to components incident vertically with respect to the image pickup surface, a lot of light components for imaging from oblique directions. Circles of confusion of light collected by microlenses arranged at the image pickup surface for respective pixels are not always formed uniformly in center sections of each pixel of the image sensor but are shifted from the pixel centers depending on the positions of each pixel. Therefore, even in a case in which a plane with a uniform illuminance is photographed, the amount of light received is decreased in light receiving portions disposed in a peripheral section of the image pickup surface of the image sensor, comparing to light receiving portions in a center section of the image pickup surface around the optical axis of the photographing lens. As a result, luminance shading in which the brightness is rendered uneven depending on the positions in the image pickup surface resulting in distortion of the brightness is caused in photographing signals output from the image sensor, thereby resulting in decrease in image quality.
For example, Japanese Patent Laid-Open No. 2000-324505 discloses, as a correction method for shading correction, a method in which a plurality of pieces of shading correction data depending on the photographing state is prepared in advance as table values depending on the state of the optical system for carrying out luminance shading correction, and then an appropriately selected table value is used to carry out correction in an image processing unit for generating image data. However, if the shading correction data is provided for all of the pixels of the image sensor, the data size will be very large that requires a large capacity of the flash ROM or memory, thereby increasing the cost. Therefore, Japanese Patent No. 03824237 proposes a method of generating shading correction data by calculation using multiplication by gains determined depending on the distance from the center of the image sensor to each pixel. In a case in which the shading correction data is partially provided to obtain shading correction data for each pixel by calculation as described above, the same calculation method as that for normal pixels is not able to be applied to focus detection pixels due to the characteristics of microlenses of, and the shape of openings of, the image sensor.
Moreover, Japanese Patent Laid-Open No. 2005-303409 fails to describe luminance shading correction for focus detection pixels. When shading correction is carried out with the use of a shading coefficient optimized for normal pixels, for focus detection pixels which have a different aperture from the normal pixels and have an opening shape offset from the centers of the microlens 11, the accuracy of calculation of the defocus amount for phase difference detection can be affected.
Furthermore, in Japanese Patent Laid-Open No. 2002-131623, only peak-level luminance shading is applied as luminance shading for normal pixels. By contrast, for focus detection pixels, peak-level luminance shading and dark-level luminance shading are applied to carry out shading correction for rendering the distribution of the amount of light more uniform with a higher degree of accuracy, as compared with the normal pixels. However, when the different shading corrections are carried out for the normal pixels and the focus detection pixels as described above, generation of image data and processing for calculating the defocus amount are not able to be carried out at the same time. Therefore, this method has a problem that a relatively long period of time is required until the defocus amount is calculated.